import React from "react";
import {
  BrowserRouter as Router,
  Route,
  Switch,
  Redirect,
} from "react-router-dom";
import Home from "./pages/home";
import Login from "./pages/login";
import App from "./pages/app";
import EditGoods from "./pages/editGoods";
import Detail from "./pages/detail";
import NoMatch from "./pages/404";
import Car from "./pages/car";

export default function IRouter() {
  return (
    <Router>
      <Switch>
        <Route exact path="/" component={Login}></Route>
        <Route path="/login" component={Login}></Route>
        <Route path="/editGoods" component={EditGoods}></Route>
        <Route path="/car" component={Car}></Route>
        <Route path="/home" component={Home}>
          {/* 重定向 <Redirect to='/login'></Redirect> */}
        </Route>
        <Route path="/detail/:id" component={Detail}></Route>
        <Route path="*" component={NoMatch}></Route>
      </Switch>
    </Router>
  );
}
